<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我和领导有话说</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no"/>
    <meta content="telephone=no" name="format-detection"/>
    <link href="/Public/projects/option/css/yjxBase.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div class="topBanner">
    <div class="divLogin">登录</div>
</div>
<div class="loginInput">
    <div class="inputBox">
        <input type="text" class="inputTxt" placeholder="请输入手机号" id="phone">
    </div>
    <div class="inputBox">
        <input type="text" class="inputcode" placeholder="短信验证码" id="sms">
        <div class="smsCode" id="limit_text">获取短信验证码</div>
    </div>
    <div class="tips" id="tips" style="display: none">手机号输入错误</div>
</div>
<input type="button" value="登&nbsp;&nbsp;&nbsp;&nbsp;录" class="loginBtn" onclick="login()">
<div class="foot">浙江日报新闻发展有限公司</div>
<div class="toast">登录成功!</div>
</body>
<script src="/Public/js/jquery-1.11.0.min.js"></script>
<script>
    var timer;
    var countdown = 60;
    var obj = $("#limit_text");
    var limit = 0;
    $("#limit_text").click(function () {
        if (limit != 1) {
            timer = window.setInterval(settime, 1000);
            $.ajax({
                type: 'get',
                data: {
                    phone: $("#phone").val()
                },
                url: "/Wap/Tool/option_get_sms",
                success: function (res) {

                }
            });
        }
    });
    function settime() { //发送验证码倒计时
        console.log(countdown);
        if (countdown == 0) {
            obj.text("获取短信验证码");
            obj.css("color", "#6a68ef");
            countdown = 60;
            window.clearInterval(timer);
            limit = 0;
            return;
        } else {
            limit = 1;
            obj.css("color", "#e5e5e5");
            obj.text("重新发送(" + countdown + "s)");
            countdown--;
        }
    }
    function login() {
        var phone = $("#phone").val();
        var sms = $("#sms").val();
        $.ajax({
            type:"get",
            data:{
                phone: phone,
                sms: sms
            },
            dataType:"json",
            url:"/Wap/Tool/option_login",
            success:function(res){
                if(res['status'] < 0){
                    $("#tips").text(res['result']);
                    $("#tips").css("display", "block");
                }else{
                    if(res['status'] == 0){
                        window.location.href = "/Wap/Tool/option_view";
                    }else{
                        window.location.href = "/Wap/Tool/option_reply";
                    }
                }
            }
        });
    }
</script>
<script src="/Public/js/common/baidutongji.js"></script>
</html>
